package com.glory.dmegcpda.model

import com.glory.dmegcpda.base.Constant
import com.glory.dmegcpda.bean.*
import com.google.gson.JsonObject
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toResponse

/**
 * FileName: MaterialReceiveRepository
 * Author: XJH
 * Date: 2021/9/29 16:10
 * Description:
 * History:
 */
class QualityCheckRepository : BaseRepository() {


    suspend fun getLotInfo(bodyMap: JsonObject): LotInfoDownLoadBean {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"PVM.LOTINFODOWNLOAD"))
            .toResponse<LotInfoDownLoadBean>()
            .await()
    }

    suspend fun getDefect(bodyMap: JsonObject): DefectBean {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"SYS.GETADOWNERREFLIST"))
            .toResponse<DefectBean>()
            .await()
    }

    suspend fun getLevel(bodyMap: JsonObject): LevelBean {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"SYS.ADREFLISTHANDLER"))
            .toResponse<LevelBean>()
            .await()
    }

    suspend fun getHoldCode(bodyMap: JsonObject): LevelBean {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"SYS.ADUREFLISTHANDLER"))
            .toResponse<LevelBean>()
            .await()
    }

    suspend fun getReleaseCode(bodyMap: JsonObject): LevelBean {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"SYS.ADUREFLISTHANDLER"))
            .toResponse<LevelBean>()
            .await()
    }

    suspend fun getLotJudge(bodyMap: JsonObject): Any {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"PVM.LOTJUDGE"))
            .toResponse<Any>()
            .await()
    }

    suspend fun holdLot(bodyMap: JsonObject): Any {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"PVM.LOTHOLD"))
            .toResponse<Any>()
            .await()
    }

}